﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace BadDataAccessStrategies
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            using (SqlConnection conn = new SqlConnection(@"Server=.\sqlexpress;DataBase=Northwind;Integrated Security=SSPI"))
            {
                DataSet dsCustomers = new DataSet();
                SqlDataAdapter daCustomers = new SqlDataAdapter("select * from Customers", conn);
                daCustomers.Fill(dsCustomers, "Customers");
                gvCustomers.DataSource = dsCustomers;
                gvCustomers.DataBind();
            }
        }
    }
}
